package com.bw.hongye.other.service.impl;

import com.aliyun.common.utils.PageUtils;
import com.aliyun.common.utils.Query;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bw.hongye.other.dao.CityDao;
import com.bw.hongye.other.entity.CityEntity;
import com.bw.hongye.other.service.CityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Map;


@Service("cityService")
public class CityServiceImpl extends ServiceImpl<CityDao, CityEntity> implements CityService {

    @Autowired
    private CityDao cityDao;

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<CityEntity> page = this.page(
                new Query<CityEntity>().getPage(params),
                new QueryWrapper<CityEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public ArrayList<CityEntity> findParentId(Integer parentId) {
        return cityDao.findParentId(parentId);
    }

}